package common;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class FileTools {
	public static void copy(String dest,String source) {
		FileInputStream in = null;
		FileOutputStream out = null;
		try {
			in = new FileInputStream(new File(source));
			out = new FileOutputStream(new File(dest));
			byte[] b = new byte[1024 * 1024];
			int len = 0;
			while ((len = in.read(b)) != -1) {
				out.write(b, 0, len);
			}
			} catch (Exception e) {
				e.printStackTrace();
			}finally{
				try {
					if(in!=null)
					in.close();
				} catch (IOException e) {
					in=null;
				}
				try {if(out!=null){
					out.flush();
					out.close();
				}
				} catch (IOException e) {
					out=null;
				}
			}
	}
}
